import traceback

from app.initializer import g
from app.models import user_data
from app.utils.jwt_service import gen_jwt


def is_user_exist(account: str) -> bool:
    try:
        if account not in [user.get("account") for user in user_data]:
            return False
    except Exception as e:
        g.logger.error(traceback.format_exc())
        return False
    return True


def get_user_info(account: str) -> dict:
    return [i for i in user_data if i.get("account") == account][0]
